/*
@auther fenglei
*/
package xxutil

import (
	"github.com/duke-git/lancet/v2/strutil"
	"github.com/google/uuid"
	"strings"
)

// 移除字符串指定的头
func StrPrefixRemove(str, prefix string) string {
	if strutil.HasPrefixAny(str, []string{prefix}) {
		return strutil.Substring(str, 1, uint(len(str)))
	}
	return str
}

// 移除字符串指定的尾
func StrSuffixRemove(str, suffix string) string {
	if strutil.HasSuffixAny(str, []string{suffix}) {
		return str[:len(str)-len(suffix)]
	}
	return str
}

// UID
func SimpleUID() string {
	uid := uuid.New()
	return strings.ReplaceAll(uid.String(), "-", "")
}
